	<?php Yii::app()->clientScript->registerCoreScript('jquery');//引入Yii内置jQeury核心文件?>
        <link rel="stylesheet" href="<?php echo $this->module->assetsUrl; ?>/kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="<?php echo $this->module->assetsUrl; ?>/kindeditor/plugins/code/prettify.css" />
	<script charset="utf-8" src="<?php echo $this->module->assetsUrl; ?>/kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="<?php echo $this->module->assetsUrl; ?>/kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="<?php echo $this->module->assetsUrl; ?>/kindeditor/plugins/code/prettify.js"></script>
        <script type="text/javascript" src="<?php echo $this->module->assetsUrl; ?>/datepicker/WdatePicker.js" /></script>
        <script type="text/javascript" src="<?php echo $this->module->assetsUrl;?>/js/bootstrap-fileupload.js"></script>
        
         <script >
            var editor;
            KindEditor.ready(function(K) {
            editor = K.create('#content', {
            resizeType : 1,
            items : [
           'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage', 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about']
            });

            });
     </script>
  
<script >

	KindEditor.ready(function(K){
		var editor = K.editor({
			allowFileManager:false,
                        urlType : 'domain',
		});
		K('#Banner_img_url_a').click(function() {
			editor.loadPlugin('image', function() {
				editor.plugin.imageDialog({
					fileUrl : K('#Banner_img_url').val(),
					clickFn : function(url, title) {
                                               // var file_url_img = "http://m.kxiche.com";
                                              var file_url_img =  "http://127.0.0.1:8881";
						if(url.indexOf("http") > -1){
							K('#Banner_img_url').val(file_url_img+url);
                                                        K('#file_upload_ws').attr('src',file_url_img+url);
						}else{
							K('#Banner_img_url').val(file_url_img+url);
                                                        K('#file_upload_ws').attr('src',file_url_img+url);
						}
						editor.hideDialog();
					}
				});
			});
		});
	});

</script>


	<style type="text/css">
		#fm{
			margin:0;
			padding:10px 30px;
		}
		.ftitle{
			font-size:14px;
			font-weight:bold;
			color:#666;
			padding:5px 0;
			margin-bottom:10px;
			border-bottom:1px solid #ccc;
		}
		.fitem{
			margin-bottom:5px;
		}
		.fitem label{
			display:inline-block;
			width:80px;
		}
	</style>
	

       
        
	<script type="text/javascript">
            
		var url;
		function newUser(){
			$('#dlg').dialog('open').dialog('setTitle','新活动');
			$('#fm').form('clear');
			url = 'AjaxAdd';
		}
		function editUser(){
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$('#dlg').dialog('open').dialog('setTitle','修改活动');
				$('#fm').form('load',row);
				url = 'edit?id='+row.id;
			}
		}
		function saveUser(){
			$('#fm').form('submit',{
				url: url,
				onSubmit: function(){
					return $(this).form('validate');
				},
				success: function(result){
					var result = eval('('+result+')');
					if (result.success){
						$('#dlg').dialog('close');		// close the dialog
						$('#dg').datagrid('reload');	// reload the user data
					} else {
						$.messager.show({
							title: 'Error',
							msg: result.msg
						});
					}
				}
			});
		}
		function removeUser(){
			var row = $('#dg').datagrid('getSelected');
			if (row){
				$.messager.confirm('Confirm','Are you sure you want to remove this user?',function(r){
					if (r){
						$.post('remove_user.php',{id:row.id},function(result){
							if (result.success){
								$('#dg').datagrid('reload');	// reload the user data
							} else {
								$.messager.show({	// show error message
									title: 'Error',
									msg: result.msg
								});
							}
						},'json');
					}
				});
			}
		}
                
                function doSearch(){  
                $('#dg').datagrid('load',{  
                    id: $('#id').val(),  
                    type_id: $('#type_id').val(),
                    start_time:$('#start_time').val(),
                    end_time:$('#end_time').val()
                    
                });  
                }  
                function formatTime(val,row){  
                    
                        //return '<span style="color:red;">('+val+')</span>';  
                        return new Date(parseInt(val) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');     
                    
                }  
                
            
                
        </script>
<div class="container-fluid">

            <div class="row-fluid">
                <div class="span12">
                    <h3 class="page-title">
                        活动管理 <small>查看活动</small>
                    </h3>
                    <ul class="breadcrumb">
                        <li>
                            <i class="icon-home"></i>
                            <a href="index.html">活动管理</a> 
                            <i class="icon-angle-right"></i>
                        </li>
                        <li><a href="#">查看活动</a></li>
                      
                    </ul>
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>




            <div class="row-fluid"> 

                <h2>Basic CRUD Application</h2>
                <div class="demo-info" style="margin-bottom:10px">
                    <div class="demo-tip icon-tip">&nbsp;</div>
                    <div>Click the buttons on datagrid toolbar to do crud actions.</div>
                </div>
<!--                无查询table-->
<!--                <table id="dg" title="My Users" class="easyui-datagrid" style="width:900px;height:350px"
                       url="view"
                       toolbar="#toolbar" pagination="true"
                       rownumbers="true" fitColumns="true" singleSelect="true">
                    <thead>
                        <tr>
                            <th field="type_id" width="50">id</th>
                            <th field="title" width="50">标题</th>
                            <th field="phone" width="50">Phone</th>
                            <th field="email" width="50">Email</th>
                        </tr>
                    </thead>
                </table>-->
                
<!--                带查询table-->
                <table id="dg" class="easyui-datagrid" style="width:800px;height:400px"  
                    url="view" toolbar="#tb"  
                    title="活动列表" iconCls="icon-save"  
                    rownumbers="true" pagination="true">  
                    <thead>  
                        <tr>  
                            <th field="id" width="80">Item ID</th>  
                            <th field="type_id" width="80">类型</th>  
                            <th field="title" width="80" align="right">标题</th>  
                            <th field="start_time" width="80" align="right" formatter="formatTime">开始时间</th>  
                            <th field="end_time" width="150" formatter="formatTime">结束时间</th>  
                            
                        </tr>  
                    </thead>  
                </table>  

                
<!--                工具栏-->
                <div id="tb" style="padding:1px">  
                     <div id="toolbar">
                         
                        <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">添加活动</a>
                        <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">修改活动</a>
                        <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeUser()">删除活动</a>
                    
                    </div>
                    
                    <span>ID:</span>  
                    <input id="id" style="line-height:26px; width:50px; border:1px solid #ccc">  
                    <span>活动类型</span>  
                    <input id="type_id" style="line-height:26px;width:100px; border:1px solid #ccc" >  
                    <span>开始时间:</span>  
                    <input id="start_time" style="line-height:26px;width:100px;border:1px solid #ccc"onclick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});">  
                    <span>结束时间:</span>  
                    <input id="end_time" style="line-height:26px;width:100px;border:1px solid #ccc"onclick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});" >  
                    <a href="#" class="easyui-linkbutton" plain="true" onclick="doSearch()">Search</a>  
                </div>  


               

                <div id="dlg" class="easyui-dialog" style="width:900px;height:600px;padding:50px 20px"
                     closed="true" buttons="#dlg-buttons">
<!--                    <div class="ftitle">User Information</div>
                    <form id="fm" method="post" novalidate>-->
                        
<div class="row-fluid">
    <div class="span12">
        <!-- BEGIN SAMPLE FORM PORTLET-->   
        <div class="portlet box blue tabbable">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-reorder"></i>
                    <span class="hidden-480">活动选择</span>
                </div>
            </div>
            <div class="portlet-body form">
                <div class="tabbable portlet-tabs">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#portlet_tab1" data-toggle="tab">报名活动</a></li>
                        <li><a href="#portlet_tab2" data-toggle="tab">投票活动</a></li>
                       
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="portlet_tab1">
                            <!-- BEGIN FORM-->
                            <form action="#" class="form-horizontal">
                                <input type="hidden" id="id" name="id" class="m-wrap small" />
                                <div class="control-group">
                                    <label class="control-label">标题</label>
                                    <div class="controls">
                                        <input type="text"  id="title" name="title" placeholder="标题" class="m-wrap large" />
                                        
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">活动时间</label>
                                    <div class="controls">
                                        <input type="text" id="start_time" placeholder="开始时间" name="start_time"class="m-wrap medium" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});" />
                                        <input type="text"id="end_time" placeholder="结束时间" name="end_time" class="m-wrap medium" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});" />
                                        
                                    </div>
                                </div>
                                
                                <div class="control-group">
                                    <label class="control-label">活动图片</label>
                                    <div class="controls">
                                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                                            <img src="media/image/AAAAAA&amp;text=no+image" alt="" />
                                                    </div>
                                                    <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                                    <div>
                                                            <span class="btn btn-file"><span class="fileupload-new">Select image</span>
                                                            <span class="fileupload-exists">Change</span>
                                                            <input type="file" class="default" /></span>
                                                            <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
                                                    </div>
                                            </div>
                                            
                                    </div>
                                </div>
                                
                                
                                
                                <div class="control-group">
                                    <label class="control-label">活动类型</label>
                                    <div class="controls">
                                        
                                            <label class="radio">
                                                <input type="radio" id="type_id" name="type_id" value="100" />
                                                报名活动
                                            </label>
                                            <label class="radio">
                                                <input type="radio" id="type_id" name="type_id" value="101" />
                                                投票活动
                                            </label>  
                                  
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">Disabled Input</label>
                                    <div class="controls">   
                                        <input class="m-wrap medium" type="text" placeholder="Disabled input here..." disabled />
                                        <span class="help-inline">Some hint here</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">Readonly Input</label>
                                    <div class="controls">   
                                        <input class="m-wrap medium" readonly type="text" placeholder="Readonly input here..." disabled />
                                        <span class="help-inline">Some hint here</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">Small Dropdown</label>
                                    <div class="controls">
                                        <select class="small m-wrap" tabindex="1">
                                            <option value="Category 1">Category 1</option>
                                            <option value="Category 2">Category 2</option>
                                            <option value="Category 3">Category 5</option>
                                            <option value="Category 4">Category 4</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">Medium Dropdown</label>
                                    <div class="controls">
                                        <select class="medium m-wrap" tabindex="1">
                                            <option value="Category 1">Category 1</option>
                                            <option value="Category 2">Category 2</option>
                                            <option value="Category 3">Category 5</option>
                                            <option value="Category 4">Category 4</option>
                                        </select>
                                    </div>
                                </div>
                               
                                
                                
                               
                                
                                <div class="control-group">
                                    <label class="control-label">Checkbox</label>
                                    <div class="controls">
                                        <label class="checkbox">
                                            <input type="checkbox" value="" /> Checkbox 1
                                        </label>
                                        <label class="checkbox">
                                            <input type="checkbox" value="" /> Checkbox 2
                                        </label>
                                    </div>
                                </div>
                                
                                <div class="control-group">
                                    <label class="control-label">Textarea</label>
                                    <div class="controls">
                                        <textarea class="medium m-wrap" rows="3"></textarea>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">Large Textarea</label>
                                    <div class="controls">
                                        <textarea id="content" class="large m-wrap" rows="3"></textarea>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <button type="submit" class="btn blue"><i class="icon-ok"></i> Save</button>
                                    <button type="button" class="btn">Cancel</button>
                                </div>
                            </form>
                            <!-- END FORM-->  
                        </div>
                  
                        <div class="tab-pane " id="portlet_tab2">
                            <h4>Login Form</h4>
                            <form action="#">
                                <input type="text" class="m-wrap" placeholder="Email" /><br />
                                <input type="password" class="m-wrap" placeholder="Password" />
                                <label class="checkbox">
                                    <input type="checkbox" /> Remember me
                                </label>
                                <button type="submit" class="btn green">Sign in</button>
                            </form>
                            <hr />
                            <h4>Login Form</h4>
                            <form action="#">
                                <div class="input-icon left">
                                    <i class="icon-envelope"></i>
                                    <input type="text" class="m-wrap" placeholder="Email" />
                                </div>
                                <div class="input-icon left">                                          
                                    <i class="icon-lock"></i>
                                    <input type="password" class="m-wrap" placeholder="Password" />
                                </div>
                                <label class="checkbox">
                                    <input type="checkbox" /> Remember me
                                </label>
                                <button type="submit" class="btn purple">Sign in</button>
                            </form>
                            <hr />
                            <form action="#">
                                <div class="input-prepend">                
                                    <button class="btn blue">Login</button><input class="m-wrap" size="16" type="password" placeholder="Your Password" />
                                </div>
                            </form>
                            <h4>Search Form</h4>
                            <form action="#">
                                <div class="input-append hidden-phone">  
                                    <input class="m-wrap medium" size="10" type="text" placeholder="Twitter Username" /><button class="btn red">Search</button><button class="btn black">Back</button>
                                </div>
                                <div class="input-append visible-phone">  
                                    <input class="m-wrap" size="10" type="text" placeholder="Twitter Username" /><button class="btn red">Search</button><button class="btn black">Back</button>
                                </div>
                            </form>
                            <hr />
                            <form action="#" class="form-search">
                                <div class="input-append">
                                    <input class="m-wrap" type="text" /><button class="btn green" type="button">Search!</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- END SAMPLE FORM PORTLET-->
    </div>
</div>
<!-- END PAGE CONTENT--> 

                        
<!--                    </form>-->
                </div>
                <div id="dlg-buttons">
                    <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()">Save</a>
                    <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>
                </div>
            </div>    

    
                
</div>